<%= render partial: 'js_head' %>

<% content_for :page_title do %>
  <%= link_to Spree.t(:taxonomies), spree.admin_taxonomies_url %> /
  <%= @taxonomy.name %>
<% end %>

<div id="ajax_error" class="errorExplanation" style="display:none;"></div>

<%= form_for [:admin, @taxonomy] do |f| %>
  <fieldset>
    <%= render partial: 'form', locals: { f: f } %>
    <div class="form-group">
      <%= label_tag nil, Spree.t(:tree) %>
      <script>
        Spree.routes.taxonomy_taxons_path = "<%= spree.api_v1_taxonomy_taxons_path(@taxonomy) %>";
        Spree.routes.admin_taxonomy_taxons_path = "<%= spree.admin_taxonomy_taxons_path(@taxonomy) %>";
        Spree.routes.jstree_theme_path = "<%= stylesheet_path("jquery.jstree/themes/spree/style.css") %>";
      </script>
      <div id="taxonomy_tree" class="tree">
        <div class="alert alert-warning">
          <%= Spree.t(:loading_tree) %>
        </div>
      </div>
    </div>

    <div class="alert alert-info">
      <%= Spree.t(:taxonomy_tree_instruction) %>
    </div>

    <div class="form-actions">
      <%= button Spree.t('actions.update'), 'save.svg', 'submit', { class: 'btn-success' } %>
      <span class="or"><%= Spree.t(:or) %></span>
      <%= button_link_to Spree.t('actions.cancel'), admin_taxonomies_path, icon: 'cancel.svg' %>
    </div>
  </fieldset>
<% end %>
